<?php
//debug($_SESSION);
//debug($moderators);
?>

<table width="1024px">
    <tr ><td><div  style="float:right">
     <?php echo $this->Html->link(
        $this->Html->image('../img/add_more.png', array('alt' =>'Add more')),array('action'=>'admin_register'),
                array('escape' => false,'class'=>'noprint')
        ); ?></div></div></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
        <td>
            <table width="100%" id="table" >
                <tr >
                    <th width="224px"><?php echo $this->Paginator->sort("Login",'username'); ?></th>
                    <th width="250px"><?php __("Email"); ?></th>
                    <th width="100px"><?php __('Points');?>
                    <th width="40px"><?php __("Edit")?></th>
                    <th width="40px"><?php __("Delete");?></th>
                    
                </tr>
<?php foreach ($moderators as $data): ?>
                    <tr id="table_content">
                        <td><?php echo $data['User']['username'];?></td>
                        <td><?php echo $data['User']['email']; ?></td>
                        <td><?php (!empty($data['UserCredit']['points'])) ?  __($data['UserCredit']['points']) : __('0')  ?></td>
                        <td><?php echo $this->Html->link($this->Html->image('user_edit.png', array('alt' => 'Edit','title'=>'edit' ,'border'=>'0')), array('action' => 'admin_edit', $data['User']['id']), array('escape' => false)); ?></td>
                        <td><?php echo $this->Html->link($this->Html->image('trash.png', array('alt' => 'Delete','title'=>'Delete' ,'border'=>'0')), array('action' => 'admin_delete', $data['User']['id']), array('escape' => false,'onclick'=>"return confirm('Are you sure you want to delete?')")); ?></td>
                    </tr>
                        <?php endforeach; ?>
                <tr><td colspan="5">
                        
<!-- Shows the next and previous links -->
<?php echo $this->Paginator->prev('« Previous', null, null, array('class' => 'disabled')); ?>
<span style="width: 20px">&nbsp;</span>
<?php echo $this->Paginator->numbers(); ?>
<span style="width: 20px">&nbsp;</span>
<?php echo $this->Paginator->next('Next »', null, null, array('class' => 'disabled')); ?>

<span style="width: 20px">&nbsp;</span>
<!-- prints X of Y, where X is current page and Y is number of pages -->
<?php echo $this->Paginator->counter(); ?></td>
                </tr>
            </table>
        </td>
    </tr>
</table>




